using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Rhizome.Contract;
using Rhizome.Contract.Diag;
using Rhizome.Model.Validation;

namespace Rhizome.Model
{
	public sealed class RandomState : RhizomeElement, IValidate, IStatesDiag
	{
		public RandomState(double value, object state)
		{
			Value = value;
			State = state;
		}

		public RandomState()
		{
		}

		public double Value { get; set; }
		public object State { get; set; }

		#region Implementation of IValidate

		IEnumerable<IValidationResult> IValidate.GetValidationResults()
		{
			if (State == null) yield return ValidationResult.StateNotSet;
		}

		#endregion

		#region Implementation of IStatesDiag

		IEnumerable<object> IStatesDiag.StateIds
		{
			[DebuggerStepThrough]
			get { yield return State; }
		}

		#endregion
	}
}